#ifndef GTROBOTCOM_H
#define GTROBOTCOM_H

#include <QObject>
#include <qtcpserver.h>
#include <qtcpsocket.h>

#include "_Interface/_global_datastruct.h"
#include "Package/simpletcpserverdll_global.h"
#include "Package/simpletcpsocketdll_global.h"

class gtrobotcom{
public:
    int  toRobotSocket;
    int  fromRobotServer;
    bool CanSendtoRobot;

    bool RobotFirstConnectMark;
    bool RobotConnectMark;
    bool NewMessageCanRead;
    bool NewMessageReadDone;

    QByteArray RecvRawRobotData;
    QByteArray SendRawRobotData;

    ST_RobotDAQData mRobotDAQData;
    ST_RobotAdjData mRobotAdjData;
public:
    gtrobotcom();
    ~gtrobotcom();

public:
    bool  getRobotConnectStatus();

    short toRobotTcpServerAdd();
    short toRobotTcpServerListen();

    short ReadRobotJointData(double (&data)[6]);
    short ReadRobotJointTorData(double (&data)[6]);
    short ReadRobotTTSOffsetData(double (&data)[6]);
    short ReadRobotTechVarBoolData(bool (&boolgroup)[8]);
    short ReadRobotTechVarValueData(bool (&valueGroup)[8]);

    short SetRobotPosTTSOffsetData(double data[3]);

    bool  NewMessageBackendReadDone();
public:
    short RobotRecvDataDeal();
    short RobotSendDataDeal();

    short toRobotReceiveLoopRun();
    short toRobotSendLoopRun();
};

class gtrobotcomfsw : public gtrobotcom{
public:
    ST_FswTecDAQData FswTecData;
public:
    gtrobotcomfsw();
    ~gtrobotcomfsw();
public:

    short ReadInitPosDone(bool &done);
    short ReadEndPosDone(bool &done);
    short ReadSpindleSpeed(double& data);
    short ReadForceControlForceInitSetValue(double &data);
    short ReadForceControlForceSetValue(double &data);
    short ReadForceControlStep(double& mstep);
    short ReadInitPosDelayTime(int &time);
    short ReadForceControlForceRealValue(double &data);
    short ReadPointLaserValue(double &data);

    short WriteRobotFzDirOffset(double Offset);
    short WriteRobotOVN(double Ovn);
};
#endif // GTROBOTCOM_H
